package main

import (
	"strings"
)

func main() {
	println(originalDigits("zeroonetwothreefourfivesixseveneightnine"))
}

func originalDigits(s string) (ans string) {
	m := make(map[uint8]int)
	for i := range s {
		m[s[i]]++
	}

	res := make([]string, 10)
	res[0] = str(m['z'], '0')
	res[2] = str(m['w'], '2')
	res[4] = str(m['u'], '4')
	res[6] = str(m['x'], '6')
	res[8] = str(m['g'], '8')
	res[3] = str(m['h']-m['g'], '3')
	res[5] = str(m['f']-m['u'], '5')
	res[7] = str(m['s']-m['x'], '7')
	res[1] = str(m['o']-m['u']-m['w']-m['z'], '1')
	res[9] = str(m['i']-m['f']+m['u']-m['x']-m['g'], '9')

	for _, str := range res {
		ans += str
	}
	return
}
func str(num int, char uint8) string {
	println(num, char)
	s := strings.Builder{}
	for num > 0 {
		s.WriteByte(char)
		num--
	}
	return s.String()
}
